// 
//  Copyright 2011  reda
// 
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
// 
//        http://www.apache.org/licenses/LICENSE-2.0
// 
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
using System;
using ManiacMusicManager.Data.Core;
using NHibernate;
using ManiacMusicManager.Data.DAO.Ifaces;
using System.Collections.Generic;
using ManiacMusicManager.Data.Utils;
namespace ManiacMusicManager.Data.DAO
{
	public class ChansonDAO : AbstractDAO<Chanson>, IChansonDAO
	{
		public ChansonDAO (ISession session)
			: base(session)
		{
		}
		
		#region IChansonDAO implementation
		public IEnumerable<Chanson> SelectByYear (uint min, uint max)
		{
			return SelectByQuery(FilterOnInteger(x => (int)x.AnneeDeSortie, (int)min, (int)max));
		}
		
		public IEnumerable<Chanson> SelectByTag (string tag)
		{
			var filter = FilterOnStringList(x => x.ChansonTags, tag, StringSearchOptions.ExactIgnoreCase);
			return SelectByQuery(filter);
		}
		#endregion
	}
}

